
package com.hlkj.pay.infrastructure.model.merchant;

import java.util.List;

import org.springframework.util.StringUtils;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hlkj.framework.common.util.collection.CollectionUtils;
import com.hlkj.framework.common.util.json.JsonUtils;
import com.hlkj.framework.mybatis.core.dataobject.BaseDO;
import com.hlkj.pay.dto.merchant.MerchantAccessBusinessLicense;
import com.hlkj.pay.dto.merchant.MerchantAccessScene;
import com.hlkj.pay.dto.merchant.MerchantAccessSignLink;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 商户经营信息
 * 
 * @TableName t_merchant_access_info
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("t_merchant_access_business")
public class MerchantAccessBusinessDO extends BaseDO {
    /**
     * 进件id
     */
    private Long accessId;
    /**
     * 商户商户号
     */
    private String sn;
    
    /**
     *
     */
    private String shortName;
    /**
     * 经营类型 1：实体，2：虚拟
     */
    // private Integer businessType;
    @Schema(description ="场景类型 1 线上 2 线下 3 ALL")
    private Integer sceneType;

    /**
     * MCC编码
     */
    @Schema(description = "MCC编码 字典接口通过 dictKey=mccCategory 获取一级 然后通过 dictKey=mccCategory,parentDictKey=一级code 获取 ")
    private String mcc;
    /**
     * MCC编码
     */
    @Schema(description ="微信 MCC编码 字典接口通过 dictKey=mccWechat 获取一级 然后通过 dictKey=mccWechat,parentDictKey=一级code 获取 ")
    private String wechatMcc;
    /**
     * MCC编码
     */
    @Schema(description ="微信 MCC编码 字典接口通过 dictKey=mccAlipay 获取一级 然后通过 dictKey=mccAlipay,parentDictKey=一级code 获取 ")
    private String alipayMcc;


    /**
     * 门店门头url
     */
    private String storeHeaderUrl;

    /**
     * 店铺内景url
     */
    private String storeIndoorUrl;

    /**
     * 店铺收银台 前台url
     */
    private String storeCashierDeskUrl;

    /**
     * 客服电话
     */
    private String servicePhone;

    /**
     * 省份编码
     */
    private String provinceCode;

    /**
     * 城市编码
     */
    private String cityCode;

    /**
     * 区域编码
     */
    private String areaCode;

    /**
     * 地址
     */
    private String address;

    /**
     * 办公场地面积
     */
    private String officeSpace;

    /**
     * 办公场地性质 1:自有办公用地，2:租用办公场地，3:无固定办公场地
     */
    private String officeSpaceType;

    /**
     * 业务描述
     */
    private String businessDesc;
    /**
     * 文件签署链接
     */
    private String signLink;
    /**
     * 经营资质
     */
    private String licenseJson;
    /**
     * 其他附件
     */
    private String fileUrlJson;
    /**
     * 经营Scene
     */
    private String sceneJson;
    /**
     * 文件签署信息
     */
    @TableField(exist = false)
    private List<MerchantAccessSignLink> signLinks;

    /**
     * 经营资质
     */
    @TableField(exist = false)
    private List<MerchantAccessBusinessLicense> businessLicenses;
    /**
     * 经营资质
     */
    @TableField(exist = false)
    private List<MerchantAccessScene> sceneList;
    

    
    /**
     * 其他附件
     */
    @TableField(exist = false)
    private List<String> fileUrls;


    public List<MerchantAccessBusinessLicense> getBusinessLicenses() {
        if (!CollectionUtils.isEmpty(this.businessLicenses)) {
            return this.businessLicenses;
        }
        if (StringUtils.hasText(licenseJson)) {
            setBusinessLicenses(JsonUtils.parseArray(licenseJson, MerchantAccessBusinessLicense.class));
        }
        return this.businessLicenses;
    }

    public List<String> getFileUrls() {
        if (!CollectionUtils.isEmpty(this.fileUrls)) {
            return this.fileUrls;
        }
        if (StringUtils.hasText(fileUrlJson)) {
            setFileUrls(JsonUtils.parseArray(fileUrlJson, String.class));
        }
        return this.fileUrls;
    }
  
    
    public List<MerchantAccessSignLink> getSignLinks() {
        if (!CollectionUtils.isEmpty(this.signLinks)) {
            return this.signLinks;
        }
        if (StringUtils.hasText(signLink)) {
            setSignLinks(JsonUtils.parseArray(signLink, MerchantAccessSignLink.class));
        }
        return this.signLinks;
    }
    public List<MerchantAccessScene> getSceneList() {
        if (!CollectionUtils.isEmpty(this.sceneList)) {
            return this.sceneList;
        }
        if (StringUtils.hasText(sceneJson)) {
            setSceneList(JsonUtils.parseArray(sceneJson, MerchantAccessScene.class));
        }
        return this.sceneList;
    }
}
